import cv2
import location

scene_list = [
    'category.png',
    'liulanwanbi.png',
    'mysp.png',
    'list.png',
    'guc.png',
    'wifi.png',
    'notbuy.png',
]

# 获取场景
def getscene(cut_main_gray):
    for scene in scene_list:
        scene_gray = cv2.cvtColor(cv2.imread('./scene/' + scene), cv2.COLOR_BGR2GRAY)
        locations = location.getlocations(cut_main_gray, scene_gray)

        if len(locations) > 0:
            if 'category' in scene:
                return "分类"
            elif 'list' in scene:
                return "商品列表"
            elif 'mysp' in scene:
                return "没有商品"
            elif 'liulanwanbi' in scene:
                return "浏览完毕"
            elif 'guc' in scene:
                return "商品详情"
            elif 'wifi' in scene:
                return "断开"
            elif 'notbuy' in scene:
                return "缺货"
    return "未知"